import WebView from 'react-native-webview';
import { View, Button, Text } from 'react-native';
import { TestCase, Tester, TestSuite } from '@rnoh/testerino';

export default function WebViewTestStartInLoadingState() {
  return (
    <View style={{ flex: 1 }}>
      <Tester style={{ paddingBottom: 80 }}>
        <TestSuite name="react-native-webview">
          <TestCase
            key={'webview-startInLoadingState'}
            itShould={`测试WebView的startInLoadingState属性`}
            tags={['C_API']}
            initialState={false}
            arrange={({ setState }) => (
              <View style={{ padding: 20 }}>
                <Text style={{ fontSize: 16, marginBottom: 10 }}>startInLoadingState: false</Text>
                <View style={{ height: 200, borderWidth: 1, marginBottom: 20 }}>
                  <Text>startInLoadingState 为 false 时 不开启加载状态初次加载不显示旋转图标 </Text>
                  <WebView
                    source={{ uri: 'https://www.example.com' }}
                    startInLoadingState={false}
                  />
                </View>
                
                <Text style={{ fontSize: 16, marginBottom: 10 }}>startInLoadingState: true</Text>
                <View style={{ height: 200, borderWidth: 1, marginBottom: 20 }}>
                  <Text>startInLoadingState 为 true 时 开启加载状态初次加载显示旋转图标 </Text>
                  <WebView
                    source={{ uri: 'https://www.example.com' }}
                    startInLoadingState={true}
                  />
                </View>
              </View>
            )}
            assert={async ({ expect, state }) => {
              expect(state).to.be.true;
            }}
          />
        </TestSuite>
      </Tester>
    </View>
  );
}